package com.zwb.demo.easyweb.modules.config.controller;


import com.zwb.demo.easyweb.common.entity.response.ResponseResult;
import com.zwb.demo.easyweb.modules.config.vo.GenTemplateVO;
import com.zwb.demo.easyweb.modules.config.service.GenTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "生成模板管理接口" ,description = "生成模板管理接口")
public class GenTemplateController {


    private final GenTemplateService genTemplateService;

    @Autowired
    public GenTemplateController(GenTemplateService genTemplateService) {
        this.genTemplateService = genTemplateService;
    }

    @GetMapping("/config/template")
    @ApiOperation(value = "查询所有生成模板")
    public ResponseResult findAll(){
        return genTemplateService.findAll();
    }

    @PutMapping("/config/template")
    @ApiOperation(value = "新增或修改生成模板")
    public ResponseResult addOne(@RequestBody GenTemplateVO vo){
        return genTemplateService.saveOne(vo);
    }

    @DeleteMapping("/config/template/{uuid}")
    @ApiOperation(value = "删除生成模板")
    public ResponseResult deleteOne(@PathVariable String uuid){
        return genTemplateService.deleteOne(uuid);
    }

}
